Repository navigation
fix(plugin-approvals): an approval request is titled by its flow's label, never the raw record id or the flow's machine name - #24708
Conversation
…bel, never the raw record id
WIP: title pointer moves to process_label (served by the approvals get),
titleFormat drops {record_id}, display_title drops its record-id half.
Claude-Session: https://claude.ai/code/session_011TdZ8GjixNZFLz1xJD9zzK
Co-authored-by: Claude <noreply@anthropic.com>
…ew help text Claude-Session: https://claude.ai/code/session_011TdZ8GjixNZFLz1xJD9zzK Co-authored-by: Claude <noreply@anthropic.com>
…proval-request-title
…tract Claude-Session: https://claude.ai/code/session_011TdZ8GjixNZFLz1xJD9zzK Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 0bd2399c1bdaa16bfe0ba4b1604618031c4e127a && git checkout 0bd2399c1bdaa16bfe0ba4b1604618031c4e127a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8e14ce057415992cb045fe712860f21cf29c3036 1b47ec0748a12fbf8a8ad312e80f3178aef3f35c && git checkout -B drift-repro 8e14ce057415992cb045fe712860f21cf29c3036 && git merge --no-ff 1b47ec0748a12fbf8a8ad312e80f3178aef3f35c
node scripts/docs-audit/affected-docs.mjs --json 8e14ce057415992cb045fe712860f21cf29c3036
|
席位核对 · ACCEPT ·
|
… on, Approve leads the band, one time face (objectstack-ai#36095) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu5xKbCuyXQ5nYfei9GkjzN3)_ Fixes objectstack-ai#35415 repo:objectstack#1 · os-sales · session_01L6bhgW5RH2VUXjRj9dZYH2 Clause-②: yes (widening) Metadata-protocol: none The widening: `@object-ui/components` takes one optional member, `RecordHeaderState.title`, and exports its type `RecordHeaderTitle`. Nothing is removed or renamed. ## 维护者速读 - 审批请求页的标题从流程名(「费用报告签批」)换成审批人要看的业务记录名(「EXP-2001」),点标题就打开那条记录。只有页面自己读得到那条记录时标题才是链接;无权读、读不到、或平台标记已删除时,标题只显示名字、不能点,和同页「提交时的内容」卡片的规则一致。取不到记录名时仍显示流程名,标题里不会出现裸记录 id。 - 流程名只在标题下方高亮条的「流程」一格出现一次。卡片第 1 条写了「副标题写流程名」,这里没有加副标题:那一格已经紧贴在标题下方,再加副标题就是卡片抱怨的重复。 - 审批条里「通过」仍是实心主按钮,「驳回」改为描边加危险色文字,「通过」成为页面上最醒目的按钮。业务记录页上的审批条是同一个组件,也一起变。 - 审批动态里的时间改成和页头一样的写法(`2026/11/21 上午10:09`),不再带秒。 - 列表、搜索、最近访问和面包屑里,审批请求仍按流程名称呼,对象定义不变。只改前端显示,可以整体撤回。 ## What changes Card objectstack-ai#35415 lists four defects on the approval request page. Read against main `fe753492`, two still held, one held in part, and one was already fixed: | Card item | On main | This PR | |:---|:---|:---| | 1. The title is the flow's name; the record cannot be opened from it | held | the title names the record and links to it | | 2. "As submitted" truncates text fields | fixed by objectstack-ai#34588 (the record is drawn whole, values wrap) | nothing to do; the screenshots confirm | | 3. Approve looks weaker than Reject | half: Approve was already filled, Reject was filled red | Reject becomes a destructive outline | | 4. Two time formats on one page | held | the timeline uses the page's one face | - **The page title (`RecordDetailView`, new `approval-decision/approvalSubjectTitle.tsx`).** On a `sys_approval_request` page the header names the business record by the `record_title` the approvals get already serves for it, as a link through the page's own record route (`RelatedRecordActionsBridge`'s `recordHref` / `openRecord`, the route the "As submitted" card's "Open record" link takes). A plain click opens the record the way the page opens one, which is the record drawer one level down on a desktop record page; a modifier or middle click keeps the anchor's new-tab behaviour. The name is a link only once one of the page's own reads of the record returned it, the rule the card's link follows (objectui#12557, objectui#11878): `SubmittedRecord`'s current read and `RecordPreviewCard`'s read report what they found through the new `RecordReadReportContext` (`approval-decision/recordReadReport.ts`), which `RecordDetailView` provides on a request page only. The title makes no read of its own. A refused, unresolvable or platform-deleted subject is named as plain text. Where the get serves no `record_title`, or one equal to the bare `record_id`, the header keeps the request's own title (`process_label`), so the page never names its subject by a raw id. That is the guarantee objectstack-ai#24665 / PR objectstack-ai#24708 gave the H1, kept here. - **`RecordHeaderState.title` (`@object-ui/components`).** The host hands `{ text, node? }`, and `page:header` draws `node` (else `text`) in its H1 in both faces: in the host's top bar and in its own row (phone, and pages with no bar). Absent, or with an empty `text`, every title rung the header had is unchanged. It sits beside the state's existing `tags`, `group` and `stage`. - **No subtitle.** The strip directly under the title already names the flow in its Flow chip, so the flow is named once. The card's item 1 asked for the flow as a subtitle. Adding one would put back the duplicate the card's first bullet complains about, so this PR does not add it. This reading is the one the claim (comment 7060828003, scope item 2) records. - **The decision band (`DeclaredActionsBar`).** In the approver's band (`foldDecisions`, drawn by the request page's panel and by the business record page's band), a declared `danger` decision is drawn as an outline button in the destructive text colour. That is the face the record header's group already gives a secondary danger lever (objectstack-ai#35593), and the two now share one condition (`secondaryDanger`). Approve keeps the filled primary face. A bar that does not fold keeps the declared filled danger face, and overrides keep their amber face. - **One time face (`ApprovalActionTimeline`).** Action times render through core's `formatDateTime(…, { style: 'compact' })`, the face every `datetime` cell and the strip's `updated_at` chip draw, in the host's display time zone. They used to be the browser's `toLocaleString` (seconds, a 24-hour clock under zh-CN). The timeline on a business record page's approvals panel is the same component, so it changes too. - `plugin-approvals`: comments only, in `sys-approval-request.object.ts` and `sys-approval-request.page.ts`, saying where the request page now names its record. The object's `nameField`, `highlightFields` and the page metadata are unchanged. Not changed, per the card's "不做的": the structure of the progress and timeline cards. ## Why An approver opens a request to decide on a business record. The page was titled by the process, which the strip repeated, and the record it is about had no name in the header and no link from it. The reject button outweighed approve, and the page wrote one moment in two ways. ## Verification Tests added (each run red with its fix ablated, green with it): - `approvalSubjectTitle.test.tsx` (new): read by the page, the title links through the host route; not read, plain text; a host that routes nowhere, plain text; a plain click is the host's `openRecord`, a modifier click the browser's; no title or an id-only title keeps the page's own. Ablating the read gate reds the not-read case. - Served request page (console, real adapter stack): `servedPageRecordLink-12557` gains an H1 case (the H1 reads the subject and its plain click opens the same drawer, the page stays put) and the readable case now counts the card's link and the H1's; its refused CONTROL also checks the H1 is plain `INV-2020`. `servedPageReferenceStates-12489`: readable names and links the H1; deleted names it as plain `INV-3030`. `ApprovalsInboxPage.opensServedPage-12484`: the served page is recognised by the subject's title in its H1. Ablating the read gate reds the refused CONTROL; ablating the report provider reds the two H1-link cases. - `RecordDetailView.harness.test.tsx`, block `RecordDetailView.approvalSubjectTitle-35415` (real `RecordDetailView`, real `page:header`, desktop top bar): the H1 reads the served subject title, and with no reader of the subject on that page it links nowhere and reads nothing; no `record_title` keeps the flow label with no link; a `record_title` equal to the record id keeps the flow label and never prints the id; CONTROL: another object with the same fields keeps its own title. Ablating the host wiring reds the subject case only. - `page-header-record-bar-35593.test.tsx`, block `the record state's title (objectstack#35415)`: the host's node is drawn inside the H1 in the bar and in the row; text-only; CONTROL: an empty title leaves the record's own name. Ablating the renderer reds the three host cases. - `DeclaredActionsBar.approverFold-34361.test.tsx`, block `…leads with a filled Approve, Reject outlined (objectstack#35415)`: Approve `bg-primary`, Reject outline with `text-destructive` and no `bg-destructive`; CONTROL: a bar that does not fold keeps `bg-destructive`. - `RecordApprovalsPanel.displayLocale-9909.test.tsx`: the de-DE and en pins now read the compact face (`4.3.2020 3:30 pm`, `3/4/2020 3:30 pm`), and a new zh-CN pin equals `formatDateTime(…, { style: 'compact' })` with no seconds. The three "is a reading of the session" pins are unchanged and green. Local runs on this head (`88775b7e`, main `493ad095` merged in, so objectstack-ai#35983's two-row record header is in): - vitest, `ui/` root, on this head: every ui test file that names an approval request, `DeclaredActionsBar`, `ApprovalActionTimeline`, `RecordHeaderState`, `RecordPreviewCard`, `SubmittedRecord`, the record pointer card, `RecordDetailView`, `ApprovalDecisionPanel` or `page:header` (490 files, console included): `Test Files 490 passed`, `Tests 6483 passed`. The first CI run on `9097b572` was red in three console served-page files (16 tests); this commit is the fix, above. - `turbo run type-check` for `@object-ui/components`, `@object-ui/app-shell` and `@object-ui/console`, on this head: 0 `error TS`. - `eslint` over the changed files: 0 errors. - `overlap-check.mjs` on this head: clean against origin/main `493ad095`, objectstack-ai#36105 and objectstack-ai#35923. Browser (showcase `objectstack dev --seed-admin --fresh`, console `vite`, zh-CN, the seeded pending request on `EXP-2001`, opened as its approver through `/system/approvals?request=`), before and after at 1280 and 375, light and dark, in the project thread's evidence folder: - before: H1 `费用报告签批`, no link; Reject `bg-destructive`; timeline `2026/11/21 10:09:5x`. - after (shot on `a02cb373`, where the subject reads, so the gate added since draws the same page; with objectstack-ai#35983's two-row header: the crumb row reads 审批请求, the title row reads the record): H1 `EXP-2001`, linked to `/apps/com.example.showcase/showcase_expense_report/record/…`; a click opens `EXP-2001` in the record drawer; Approve filled, Reject outlined; timeline `2026/11/21 下午1:37`, the same face as the strip's `更新时间` chip. ## Acceptance notes - Read first, by risk: `ui/packages/components/src/renderers/layout/containers.tsx` (`hostTitle` / `chipTitle`, both faces), `ui/packages/app-shell/src/views/approval-decision/approvalSubjectTitle.tsx` and `recordReadReport.ts` (the link's read gate), `ui/packages/app-shell/src/views/DeclaredActionsBar.tsx` (`secondaryDanger`). - Two-minute check: open a pending approval from the approvals inbox. The top bar reads the record's name, not the flow's. Click it and the record opens. In the band, 通过 is filled and 驳回 is outlined in red. The 审批动态 time reads like the strip's 更新时间. - The subject link follows the page's record route, so it exists exactly where the "As submitted" card's "Open record" link does: a subject object the console can route to. Where it cannot, the title is the record's name as plain text. - Breadcrumb, recent items and favourites still name a request by its own title (the flow), as lists and search do. Only the request page's header names the subject. - Observed, not changed: at 375 px the strip's `更新时间` value is cut (`上午10:…`) in a half-width cell. That is the strip's layout, outside this card. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (Not touched.) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgW5RH2VUXjRj9dZYH2 <!-- signed: repo:objectstack#1 · os-sales · session_01L6bhgW5RH2VUXjRj9dZYH2 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Fixes #24665
Clause-②: no
objectstack-ai/objectui#12484 remains blocked until the console pin bump.
What changes
The served approval request page (
sys_approval_request_detail) authors no header, so the console titles it from the object's declaration over the row the approvals get serves: thenameFieldvalue, then the deprecatedtitleFormatonly where that value is empty (ADR-0079). The pointer wasdisplay_title, a formula. A formula has no stored column androwFromRequestserves none, so every page fell through to{process_name} · {record_id}:flow:NAME · RECORD_IDas its H1.packages/plugins/plugin-approvals/src/sys-approval-request.object.ts:nameFieldanddisplayNameFieldbecomeprocess_label, the stored flow-label column. The approvals get already serves it (rowFromRequest, through the display-label chain: the column, else the config snapshot's__flowLabel, else the humanized machine name). So the page's H1 is the flow's label in every subject state, and the get serves the declarednameFieldvalue. No change toapproval-service.tsand no new key onApprovalRequestRow: the route needs no spec change.titleFormatbecomes{process_name}, without{record_id}. A renderer reaches it only whereprocess_labelis empty (a row written before the column, until the boot backfill labels it). The approvals get never reaches it.display_titlestays declared. Its expression drops the· record_idhalf:process_label, elseprocess_name. That is the text the title ladder draws on the data door for every row the engine writes. Its help text and the three translated locales say so.enwas regenerated with the package's documentedos i18n extractcommand (viapackages/cli/bin/run-dev.js), and--checkreports 7 bundles in sync.The subject record stays named by the Details tab's reference card (
record_id/object_name). That card handles the readable, deleted and unresolvable states, which a title cannot.Acceptance
nameFieldvalue, and a pin holds it. Newsys-approval-request-title.integration.test.tsuses the realApprovalServiceon realObjectQLoverSqlDriver. The declaration'snameFieldisprocess_label, atextfield with a real DDL column, andgetRequestandlistRequestsserve the same non-empty value under it.flow:machine name, in each state, one pin per state. Readable (Rd4bl3Rec24665QQ, opened by the service), deleted (subject deleted, requestcancelled/record_deleted) and unresolvable (object_namenames an object the registry does not hold). In each, the served title equals the flow label, is non-blank, does not contain the record id and does not matchflow:. A fourth case: a row with no stored label and no snapshot label is served the humanized machine name (Invoice Approval), so the template is never reached on this door.#24087(PR fix(metadata-protocol): the search palette titles a hit by nameField before the deprecated titleFormat #24202) madesearchAll'srenderTitleread thenameFieldvalue first (packages/metadata-protocol/src/protocol.ts,titlePointerthentitleFormatSource), pinned byprotocol.search-title-namefield.test.ts("THE PIN — an object declaring both keys is titled by its nameField value"). The palette'sengine.findrow carries the storedprocess_label, so a request is listed under its flow label. On an unlabelled pre-backfill row it draws{process_name}, the same fallback as the data door. No new palette pin:packages/metadata-protocolis outside this claim's file surface, and the order is already pinned there.sys-approval-display-title.test.tsflips. The request now resolves toprocess_label. A labelled row's H1,display_titleandresolveRecordTitleare allDiscount Sign-off, with no· opp_45. An unlabelled row's pointer value is empty, and the template anddisplay_titleboth drawflow:deal_desk(nevernull, never the id).resolveRecordTitleanswersundefinedthere: the accessor reads the pointer and never invents a title.The open choice inside A1, read on the four axes
display_title: retire or keep? The dispatch said to retire it if nothing but the title ladder reads it. Something else does read it. The activity mirror (plugin-auditaudit-writers.ts) stores the title field's name as the provenance of each activity row'ssummaryandrecord_label(text_sources, fromtitleFieldOf). The read side (activity-field-redaction.tssourcesServed) serves those texts only while every named field is in the reader's served set. So retiring the field would withhold the summary and label of everysys_approval_requestactivity row written while it was the title. The 18.0 upgrade fixture'sdatabase.sqlcarries thattext_sourcesshape on other objects'display_title. This is a code reading. Activity redaction was not run for this object.minor, an ADR-0087 marker, a contract review) whose cost falls on stored history. Keeping it adds nothing and declares nothing new.Recommendation taken: keep it, with the reason in the field's comment. This PR therefore narrows nothing and carries
Clause-②: nowith apatchchangeset (.changeset/24665-approval-request-title.md). That follows the newest plugin-approvals convention onmain(.changeset/24375-approval-object-chip.md,24501-list-object-column.md: apatchfor a shipped object's display change, with no key added or removed).titleFormat: drop or keep as{process_name}? Kept, at{process_name}. Dropping it would make the unlabelled-row fallback differ by consumer. objectui's derivation would land on a_title/_nameaffix field, which is the machine name again.searchAll's candidate list holds none of this object's fields, so it would fall toString(row.id), the request's own id. Keeping it gives every door the same machine-name fallback, whichdisplay_titlealso draws. The key is deprecated and lint-advisory platform-wide: 66*.object.tsfiles inpackages/declare it. Retiring it is not this card's subject.Verification
All on head
1b47ec0748, worktree offorigin/main, merged withorigin/mainat9e2722a92.pnpm --workspace-concurrency=2 --filter '@objectstack/plugin-approvals^...' build, which reportedVERDICT command-exit 0.pnpm --filter @objectstack/plugin-approvals test:Test Files 85 passed (85),Tests 1146 passed (1146), which reportedVERDICT command-exit 0.pnpm --filter @objectstack/plugin-approvals typecheck:check:test-typecheck: OK, which reportedVERDICT command-exit 0. The first run caught 3 TS2345 errors in the new test's helper typing, fixed intest(plugin-approvals): type the served-title helper over the row contract.scripts/ablation-replace.mjs(anchor hit 1 to 0, blob changed) with a trap restore. Each restore was proven: the blob equals the HEAD blob andgit diff HEADis empty. The subject is imported relatively fromsrc/, so nodistleg applies.display_title: 7 failed of 11. The served title isundefined(expected 'undefined' to be 'string'), which is the defect's own mechanism.· record_id: 2 failed of 11.{process_name} · {record_id}: 3 failed of 11.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackat1b47ec0748. They ran locally, with each exit code captured before any pipe: 65 exited 0 and 2 exited 3.pnpm check:dual-build-cjs-loadsneeds every package'sdist/.pnpm check:i18nneeds the built CLI; the package's documented extract command, run throughrun-dev.jswith--check, reports 7 bundles in sync. CI runs both.node scripts/check-plugin-teardown-shape.mjs --self-testfirst exited 3, because its pinned positive control was unreachable on the shallow clone. After fetching that commit it exited 0.--ranreconciliation: 67 derived, 65 run, 2 NOT-MEASURED (derived from the recorded exit 3), 0 UNRUN.repoproject (test:repo). This diff touches none of its tests, and CI'sTest Coreruns it.Acceptance notes
apps/console/src/services/approvalRequestsDataSource.servedPage*.test.tsx) copy the request definition withnameField: 'display_title'. They are copies, not readers, and they change with the console pin bump that approvals B1 closing card (ruling C on objectui#12438): the inbox opens a request on the served sys_approval_request page where the side sheet is, deletes the sheet, and lists each retired pin against its user report objectui#12484 waits on. Carrier: that card's dev.sys_approval_approver's title is{approver} · {request_id}(role:finance · areq_…), which also prints a raw id. Observation only: the reach was not measured, and that index object is not on the request page. Carrier: none.resolveRecordTitle(SysApprovalRequest, row)on a row with no stored label now answersundefined, where it answeredflow:NAME · RECORD_IDbefore. Server-side consumers (the activityrecord_label, lookup titles) see no title for such a row until the boot backfill labels it, which it does for every request.packages/metadata-protocol/src/protocol.search-title-namefield.test.ts:185describessys_approval_request's old declaration as the defect it pinned. That is historical and accurate, with its own inline fixture. Left as is (outside the file surface).Generated by Claude Code